<template>
  <div id="app">
    <Header v-show="$store.state.loginShow"></Header>
    <router-view />
    <Footer v-show="$store.state.loginShow"></Footer>
  </div>
</template>
<script>
import Header from "./components/Header";
import Footer from "./components/Footer";
export default {
  components: {
    Header,
    Footer,
  },
  watch:{
     "$route.path": {
      handler(newVal, oldVal) {
        if (newVal == "/login") {
          //存头部隐藏值
          this.$store.state.loginShow = false;
        } else if (newVal == "/regist") {
          //存头部隐藏值
          this.$store.state.loginShow = false;
        }  else {
          //存头部隐藏值
          this.$store.state.loginShow = true;
        }
      },
      immediate: true,
    },
  }
};
</script>
<style lang="less"></style>
